﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO;
using NPOI.SS.UserModel;
using NPOI.XSSF.UserModel;
using LightXiuCore;
namespace XiuXiuTools
{
    public class MyXiuXiuTools
    {
        static class Program
        {
            /// <summary>
            /// 应用程序的主入口点。
            /// </summary>
            [STAThread]
            static void Main()
            {
                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);
                var tool = new MyXiuXiuTools();
                tool.ShowImpDataFrm();
                tool.ShowExportDataForm();
                tool.ShowUserDataFrm();
              
            }
        }
        public void ShowImpDataFrm()
        {
            try
            {
                var frm = new ImportDataForm();
                frm.ShowDialog();

            }
            catch (Exception ex)
            {
                WriteLog.WriteLogs(ex.Message + "\r\n" + ex.StackTrace);
                MessageBox.Show(ex.Message);
            }

        }
        public void ShowUserDataFrm()
        {
            try
            {
                var frm = new EmpListForm();
                frm.ShowDialog();

            }
            catch (Exception ex)
            {
                WriteLog.WriteLogs(ex.Message + "\r\n" + ex.StackTrace);
                MessageBox.Show(ex.Message);
            }

        }

        public void ShowAboutForm()
        {
            new FormAbout().ShowDialog();
        }
        string fileReturn = "";
        public string ShowExportDataForm()
        {
            try
            {
                fileReturn = "";
                var frm = new ExportDataForm();
                frm.CalBackClick += new EventHandler(frm_CalBackClick);
                frm.ShowDialog();
                
            }
            catch (Exception ex)
            {
                WriteLog.WriteLogs(ex.Message + "\r\n" + ex.StackTrace);
                MessageBox.Show(ex.Message);
                fileReturn= "";
            }
            return fileReturn;
        }

        void frm_CalBackClick(object sender, EventArgs e)
        {
            fileReturn = sender as string;
        }
    }
}
